Micron Document
🎖️GitЯра🎖️

Node / meshtastic / Meshtastic-Android / files / feature / node / src / commonTest / kotlin / org / meshtastic / feature / node / metrics / HardwareModelSafeNumberTest.kt

Displaying Raw • Download

feature/node/src/commonTest/kotlin/org/meshtastic/feature/node/metrics/HardwareModelSafeNumberTest.kt 520fa717a938fd84682403b41f57d9f7e1ef49ef (520fa717) Text, 1.62 KB

T8b949e/*
* Copyright (c) 2026 Meshtastic LLC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
Tff7b72package T7ee787org.meshtastic.feature.node.metrics

Tff7b72import T7ee787org.meshtastic.proto.HardwareModel
Tff7b72import T7ee787kotlin.test.Test
Tff7b72import T7ee787kotlin.test.assertEquals

Tff7b72class T56d364HardwareModelSafeNumberTest Tb4b4b4{

Tf0883e@Test
Tff7b72fun Td2a8ffknownModel_returnsValueTb4b4b4(Tb4b4b4) Tb4b4b4{
Te6edf3assertEqualsTb4b4b4(Te6edf3HardwareModelTb4b4b4.Te6edf3TBEAMTb4b4b4.Te6edf3valueTb4b4b4, Te6edf3HardwareModelTb4b4b4.Te6edf3TBEAMTb4b4b4.Te6edf3safeNumberTb4b4b4(Tb4b4b4)Tb4b4b4)
Tb4b4b4}

Tf0883e@Test
Tff7b72fun Td2a8ffunset_returnsZeroTb4b4b4(Tb4b4b4) Tb4b4b4{
Te6edf3assertEqualsTb4b4b4(T79c0ff0Tb4b4b4, Te6edf3HardwareModelTb4b4b4.Te6edf3UNSETTb4b4b4.Te6edf3safeNumberTb4b4b4(Tb4b4b4)Tb4b4b4)
Tb4b4b4}

Tf0883e@Test
Tff7b72fun Td2a8ffcustomFallback_usedTb4b4b4(Tb4b4b4) Tb4b4b4{
T8b949e// Known model with custom fallback — should still return real value
Te6edf3assertEqualsTb4b4b4(Te6edf3HardwareModelTb4b4b4.Te6edf3HELTEC_V3Tb4b4b4.Te6edf3valueTb4b4b4, Te6edf3HardwareModelTb4b4b4.Te6edf3HELTEC_V3Tb4b4b4.Te6edf3safeNumberTb4b4b4(Te6edf3fallbackValue Tff7b72= T79c0ff9T79c0ff9T79c0ff9Tb4b4b4)Tb4b4b4)
Tb4b4b4}

Tf0883e@Test
Tff7b72fun Td2a8ffdefaultFallback_isNegativeOneTb4b4b4(Tb4b4b4) Tb4b4b4{
T8b949e// For known models the fallback is never used, but verify the API default
Tff7b72val Te6edf3result Tff7b72= Te6edf3HardwareModelTb4b4b4.Te6edf3UNSETTb4b4b4.Te6edf3safeNumberTb4b4b4(Tb4b4b4)
Te6edf3assertEqualsTb4b4b4(T79c0ff0Tb4b4b4, Te6edf3resultTb4b4b4) T8b949e// UNSET.value is 0, not the fallback
Tb4b4b4}
Tb4b4b4}

Served by rngit 1.5.0 - Generated in 0.09s